<title>Test animate intervals having begin-value without a matching end-value</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/SVGAnimationTestCase-testharness.js"></script>
<svg>
  <!-- No interval will be created at 5 s since the end attribute does
	   not contain a rule to end an interval starting later than 4 s. -->
  <rect x="0" y="0" width="50" height="50" fill="green">
    <animate id="anim" attributeName="visibility" to="visible" begin="0s" dur="6s" />
    <animate attributeName="x" from="100" to="100" begin="1;3;5" end="2;4" />
  </rect>
</svg>
<script>
// Setup animation test
var rootSVGElement = document.querySelector("svg");
var rect1 = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
var epsilon = 0.15;
function sample1() {
    assert_equals(rect1.x.animVal.value, 0);
    assert_equals(rect1.x.baseVal.value, 0);
}

function sample2() {
    assert_equals(rect1.x.animVal.value, 100);
    assert_equals(rect1.x.baseVal.value, 0);
}

smil_async_test(t => {
    const expectedValues = [
        // [animationId, time, sampleCallback]
        ["anim", 0.1,   sample1],
        ["anim", 1.1,   sample2],
        ["anim", 2.1,   sample1],
        ["anim", 3.1,   sample2],
        ["anim", 4.1,   sample1],
        ["anim", 5.1,   sample1]
    ];

    runAnimationTest(t, expectedValues);
});
</script>
